hysop.domain.domain module¶
Abstract interfaces for physical domains description.
* Domain
* DomainView
- class hysop.domain.domain.Domain(dim, parent_comm=None, proc_tasks=None, **kwds)[source]¶
Bases:
RegisteredObject
Abstract base class for the description of physical domains.
Initialize this object. If self._initialized was already set to True, raise a RuntimeError. Else, set self._initialized to True.
- static __new__(cls, dim, parent_comm=None, proc_tasks=None, **kwds)[source]¶
Create or get an existing physical domain of given dim on a specified MPI communicator and specific tasks.
- Parameters:
dim (integer, optional) – dim of the domain.
parent_comm (MPI.Intracomm, optional) – Parent communicator which may be split. If not given this will be hysop.core.mpi.main_comm.
proc_tasks (tuple of ints or tuples of int, optional) – Mapping between mpi process rank and task identifier. If not given all procs will be on task HYSOP_DEFAULT_TASK_ID.
- proc_tasks¶
Mapping between mpi process rank and task identifier.
- parent_comm¶
Return the parent communicator used to create this domain.
- Type:
MPI.Intracomm
- task_comm¶
Return the communicator that owns the current process. This is the sub-communicator which has been obtained by splitting the parent communicator by colors (proc_tasks).
- Type:
MPI.IntraComm
- registered_topologies¶
Dictionary of all topologies already built on this domain with topology ids as keys and
Topology
as values.- Type:
Notes
*Parent communicator is split/subgrouped according to proc_tasks. *About MPI Tasks
- proc_tasks[n] = 12 means that task 12 owns proc n
or equivalently that proc n is dedicated to task 12.
proc_tasks[n] = (12, 13) means that proc n is dedicated to both tasks 12 and 13.
- *Examples of supported mapping:
None or [1,1,1,1] : Single task (nothing more to do)
[1,2,2,2] : disjoint tasks (two task_comm created by Comm_Split and one intercommunicator for each other task)
[(1,2), (1,2), (2,), (2,)] : nested tasks (use the largest task intracommunicator as inter-task communication)
[(1,), (1,2), (2,), (2,)] : non zero intersection (Not handled yet)
[(1,2), (1,), (2,), (2,)] : non zero intersection with same leader (Not handled yet)
- *A dupped parent_comm will return another idenpendent domain instance,
because MPI communicators are hashed trough their python object id.
- register_topology(topo)[source]¶
Register a new topology on this domain. Do nothing if an equivalent topology is already in the list.
- class hysop.domain.domain.DomainView(topology_state, domain=None, **kwds)[source]¶
Bases:
TaggedObjectView
Abstract base class for views on domains.
Create and initialize a DomainView.
- static __new__(cls, topology_state, domain=None, **kwds)[source]¶
Create and initialize a DomainView.
- property all_tasks¶
Return all task id.
- current_task()[source]¶
Get task number of the current mpi process. Return always the first task in case of multi-tasks
- current_task_list()[source]¶
Get task number of the current mpi process. Return always a tuple ot taks id
- property dim¶
Return the dimension of the domain.
- property domain¶
Return the domain on which the view is on.
- property frame¶
Get symbolic frame associated to this domain.
- get_task_comm(task_id=None)[source]¶
Return the communicator that owns the current process. This is the sub-communicator which has been obtained by splitting. the parent communicator by colors (proc_tasks).
- property has_tasks¶
Return if the domains contains 2 tasks or more.
- property machine_comm¶
Return the communicator that owns the current process. This is the sub-communicator which has been obtained by splitting. the parent communicator by machine name.
- property machine_rank¶
Return the rank of the process in the machine communicator.
- property parent_comm¶
Return the parent communicator used to create this domain.
- property parent_rank¶
Return the rank of the process in the parent communicator.
- property proc_tasks¶
Return mapping between mpi process rank and task identifier.
- property registered_topologies¶
Return the dictionary of all topologies already built on this domain, with topology ids as keys and
Topology
as values.
- property task_comm¶
- task_intercomm(task_id)[source]¶
Return the intercommunicator that owns the current process with the other task given.
- task_on_proc(parent_rank)[source]¶
Get task identifier for a given mpi process (parent communicator rank).